package com.tyj.movie.util;

import lombok.Data;

import java.util.HashMap;

/**
 * 日期: 2021/6/28 21:44
 * 作者: 谭友杰
 * 类说明: 返回工具类
 */
@Data
public class R  extends HashMap<String,Object>{

    public static R ok(){
        R r = new R();
        r.put("code","0");
        r.put("msg","success");
        return r;
    }

    public static R error(Integer code,String msg){
        R r = new R();
        r.put("code",code);
        r.put("msg",msg);
        return r;
    }

    public static R ok(Integer code,String msg){
        R r = new R();
        r.put("code",code);
        r.put("msg",msg);
        return r;
    }

    public static R ok(Object data){
        R r = R.ok();
        r.put("data",data);
        return r;
    }
}
